<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="{$Assets}layui/css/layui.css">
    <script type="text/javascript" src="{$Assets}aikenjs/jquery.js"></script>
</head>
<body>
    
<div style="padding: 30px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;height: 305px;">
    <fieldset class="layui-elem-field" style="padding:20px 20px 55px;margin-bottom: 25px">
            <legend>积分变动</legend>

    <form class="layui-form" action="">
        <input type="hidden" name="id" value="{$info.id}" id="edit_id" class="layui-input">

        <div class="layui-form-item">
          <label class="layui-form-label">类型</label>
          <div class="layui-input-inline" style="color: #000;">
            <select name="type">
              <option value=""></option>
                    <option value="1" {if condition="$info.type == 1"} selected="" {/if}>增加</option>
                    <option value="2" {if condition="$info.type == 2"} selected="" {/if}>减少</option>
            </select>
          </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">积分</label>
            <div class="layui-input-block">
              <input type="text" name="active" lay-verify="required|number"  autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
              <input type="text" name="remake" lay-verify="required" autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>

      <div class="layui-form-item" style="margin-top: 10px;">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit="" lay-filter="add">确定</button>
        </div>
      </div>
      
    </form>
    </fieldset>
</div>

<script src="{$Assets}layui/layui.js?t=1515376178709"></script>
<script>
    layui.use(['form', 'layedit', 'laydate','table'], function(){
  var table = layui.table,
      form = layui.form,
      layer = layui.layer,
      layedit = layui.layedit,
      laydate = layui.laydate;
        //
        table.on('checkbox(demo)', function(obj){
            console.log(obj)
        });



  form.on('submit(add)', function(data){
    
    var adddata=JSON.stringify(data.field);
    var index = parent.layer.getFrameIndex(window.name)
                    $.ajax({
                        type:"POST",
                        url: "active_save",
                        data:{data:adddata},
                        dataType:"json",

                        success:function(datas){
                            
                          
                            if(datas==1){
                                layer.msg('操作成功!');
                                setTimeout(function(){  //  setTimeout2000
                                    parent.layer.close(index);
                                },1000);
                                
                               
                            }else if(datas==2){
                                layer.msg('操作异常!');
                                setTimeout(function(){  //  setTimeout2000
                                    parent.layer.close(index);
                                },1000);
                                
                            }
                        }
                    });



    return false;
  });



        //
        table.on('tool(demo)', function(obj){
            var data = obj.data;
            
        });

        var $ = layui.$, active = {
            

        };

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
{include file="public/footer"/}
</body>
</html>
